<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>批量导入数据</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<script type='text/javascript' src='dwr/interface/userdwr.js'></script>
     <script type='text/javascript' src='dwr/interface/areadwr.js'></script>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type='text/javascript' src='js/jquery.validate.min.js'></script>
 	<script type='text/javascript' src='js/common.js'></script>
	
	 <script type='text/javascript' src='<%=basePath %>/dwr/engine.js'></script>
	 <script type='text/javascript' src='<%=basePath %>/dwr/util.js'></script>
	
	<script type="text/javascript" src="js/PCASClass.js"></script>
	<script language="javascript" type="text/javascript" src="<%=basePath %>/date/WdatePicker.js"></script>
	<link type="text/css"  href="images/css.css"  rel="stylesheet" />
	<link href="<%=basePath%>/backStageManage/bs.css"  rel="stylesheet" type="text/css" />
	<SCRIPT type="text/javascript" src="js/jquery-latest.pack.js"></SCRIPT>
	<SCRIPT type="text/javascript" src="js/dialog2.js" ></SCRIPT>
	
<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.STYLE15 {color: #F18910}
.STYLE18 {
	color: #0F45C3;
	font-size: 14px;
}
-->
</style>
<style type=text/css>
<%--BODY {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12px; BACKGROUND: #333; PADDING-BOTTOM: 50px; MARGIN: 0px; LINE-HEIGHT: 14px; PADDING-TOP: 50px
}--%>
FORM {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
UL {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
OL {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
H1 {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
H2 {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
H3 {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
H4 {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
H5 {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
H6 {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
P {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
INPUT {
	FONT-SIZE: 12px
}
TEXTAREA {
	FONT-SIZE: 12px
}
SELECT {
	FONT-SIZE: 12px
}
BUTTON {
	FONT-SIZE: 12px
}
IMG {
	BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none
}
EM {
	FONT-STYLE: normal
}
CITE {
	FONT-SIZE: 12px; COLOR: #999; FONT-STYLE: normal
}
SMALL {
	FONT-SIZE: 12px; COLOR: #999; FONT-STYLE: normal
}
ADDRESS {
	FONT-SIZE: 12px; COLOR: #999; FONT-STYLE: normal
}
A {
	COLOR: #00f; TEXT-DECORATION: underline
}
#floatBoxBg {
	BACKGROUND: #000; FILTER: alpha(opacity=50); LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%; opacity: 0.5
}
.floatBox {
	BORDER-RIGHT: #666 5px solid; BORDER-TOP: #666 5px solid; LEFT: 40%; BORDER-LEFT: #666 5px solid; WIDTH: 300px; BORDER-BOTTOM: #666 5px solid; POSITION: absolute; TOP: 50px
}
.floatBox .title {
	PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: #333; PADDING-BOTTOM: 0px; COLOR: #fff; PADDING-TOP: 7px; HEIGHT: 23px
}
.floatBox .title H4 {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 14px; FLOAT: left; PADDING-BOTTOM: 0px; MARGIN: 0px; LINE-HEIGHT: 16px; PADDING-TOP: 0px
}
.floatBox .title SPAN {
	FLOAT: right; CURSOR: pointer
}
.floatBox .content {
	PADDING-RIGHT: 15px; PADDING-LEFT: 15px; BACKGROUND: #fff; PADDING-BOTTOM: 20px; PADDING-TOP: 20px
}
#box {
	PADDING-RIGHT: 20px; PADDING-LEFT: 20px; FONT-SIZE: 14px; BACKGROUND: #999; PADDING-BOTTOM: 20px; MARGIN: 0px 50px; PADDING-TOP: 20px
}
#box H1 {
	FONT-SIZE: 40px; LINE-HEIGHT: 50px; HEIGHT: 90px
}
#box #testFloatBox {
	MARGIN: 20px 0px; POSITION: static
}
#box TABLE {
	MARGIN: 20px 0px
}
#box H3 {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 16px; PADDING-BOTTOM: 10px; PADDING-TOP: 20px
}
CODE {
	DISPLAY: block; FONT-SIZE: 12px; MARGIN: 10px; COLOR: #333
}
#box OL {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; LIST-STYLE-POSITION: inside; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; LIST-STYLE-TYPE: decimal
}
#box OL LI {
	MARGIN: 0px 0px 20px; LINE-HEIGHT: 18px
}
#box OL LI SPAN {
	CURSOR: pointer; COLOR: #00f; TEXT-DECORATION: underline
}
#box OL LI STRONG {
	DISPLAY: block
}
BODY .iframe .content {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
#box .title SPAN {
	FONT-SIZE: 12px
}
#box P {
	LINE-HEIGHT: 18px
}
</style>

<script type="text/javascript">
	function uploadSubmit(){
		var fname = $.trim($("#xlsFile").val());
	//	var postfixName = $.trim($("#excelPostfixName").val());
	//	alert("文件名==="+fname);
		if(fname == ""){
			$("#xlsFileSpan").html("请选择你要导入的文件.");
			return false;
		}else
		{
			//从最后一个点开始,截取3三个字符
			var subName = fname.substr(fname.lastIndexOf(".")+1,fname.length);
		//	alert("文件类型："+subName);
		//	alert("转换类型："+subName.trim().toUpperCase());
			if(subName.trim().toUpperCase() != "XLS" && subName.toUpperCase() != "XLSX"){
				$("#xlsFileSpan").html("你导入的文件格式不正确.");
				return false;
			}else{
				if(subName.trim().toUpperCase() == "XLS"){
					$("#excelPostfixName").val("xls");
				}else{
					$("#excelPostfixName").val("xlsx");
				}
			}
			
			var epn = $("#excelPostfixName").val();
			//alert("excelPostfixName="+epn);
			$("#xlsFileSpan").html("");
		}
	 //   $("#importFrm").submit();
	 //   document.importFrm.enctype ="multipart/form-data";
	//	document.importFrm.submit();
	dialog("正在导入数据请耐心等待...","id:waitgif","250px","auto","id");
		return true;
	}

</script>

</head>
  
<body style="margin:0px; text-align:center;" bgcolor="#ffffff">
 <div id="top">
 	<!-- 头部-->
 	<%@include file="/manage/mainTop.jsp"%>
</div>
<div id="top2"></div> 
 <!-- 中间-->
<div id="main1">  
<!-- 左边-->
 <%@include file="/manage/mainLeft.jsp"%>
 <div class="mainr2"> 
 
   <table width="789" height="539" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
  <tr>
    <td height="500" align="left" valign="top" >
    
    <table width="788" height="545" border="0" cellpadding="0" cellspacing="0" style="border-bottom:1px solid #DBDBDB; border-left:1px solid #DBDBDB; " id="a1">
      <tr>
        <td width="112" height="22" align="center" background="images/line3.jpg" bgcolor="#FFFFFF" style="border-top:1px solid #DBDBDB; border-right:1px solid #DBDBDB; border-bottom:1px solid #DBDBDB;" >
        	<a href="dmAction!toDataListPage.action"  class="STYLE11">数据列表</a>
        </td>
        <td width="8" style="border-bottom:1px solid #DBDBDB;">&nbsp;</td>
        <td width="112" align="center" background="images/line3.jpg"  style="border:1px solid #DBDBDB; ">
        	<a href="dmAction!toAddDataPage.action" class="STYLE11">添加新数据</a>
        </td>
        
        <td width="7" style="border-bottom:1px solid #DBDBDB;">&nbsp;</td>
        <td width="110" align="center"   style="border-top:1px solid #DBDBDB; border-right:1px solid #DBDBDB; border-left:1px solid #DBDBDB; ">
        	批量导入
        </td>
        <td width="445" style="border-bottom:1px solid #DBDBDB;">&nbsp;</td>
      </tr>
      <tr>
        <td height="522" colspan="6" align="center" valign="top" bgcolor="#FFFFFF" style="border-right:1px solid #DBDBDB;">
        
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="4%" height="12" align="right">&nbsp;</td>
              <td width="96%">&nbsp;</td>
            </tr>
          </table>
      <s:form name="importFrm" id="importFrm" action="dmAction!doBatchImportBeadrollData.action" enctype="multipart/form-data" method="post" onsubmit="return uploadSubmit();">    
          <table width="775" height="171" border="0" cellpadding="0" cellspacing="0">
       <%-- <tr>
          <td height="38" colspan="2" align="right">选择省份：</td>
          <td colspan="2" align="left" valign="middle"><select name="province3"  class="input"></select>
            &nbsp;</td>
        </tr>
        <tr>
          <td height="38" colspan="2" align="right">选择城市：</td>
          <td width="168" align="left" valign="middle"><select name="city3"  class="input"></select></td>
          <td align="left" valign="middle">&nbsp;</td>
        </tr>--%>
        <tr>
        	<td height="33" colspan="4" align="center" style="color:green;">&nbsp;
        	  <s:property value="actionError" /></td>
        </tr>
        <tr>
          <td width="40" colspan="2">&nbsp;</td>	
          <td width="557" height="43"  align="left">
          	<input type="file" name="xlsFile" id="xlsFile" size="30" accept="image/xls,xlsx" />
          </td>
          <td>
          	<s:hidden name="excelPostfixName" id="excelPostfixName" value=""></s:hidden>
          </td>
        </tr>
        <tr>
        	<td width="40" colspan="2">&nbsp;</td>
			<td width="557" align="left" height="16"><span class="STYLE16">&nbsp;文件格式:&nbsp;xls,&nbsp;xlsx</span></td>
			<td>&nbsp;</td>
		</tr>
        <tr>
        	<td width="40" height="48" colspan="2">&nbsp;</td>
            <td width="557" align="left">
       		 <%-- <img src="images/sc11.jpg" width="67" height="21">--%>
          	  <input type="submit" value="导入数据 " align="middle" class="button" />
			  <input type="reset"  value=" 取  消 "  />&nbsp;&nbsp;
			  <span id="xlsFileSpan" style="color: red;"></span>
           </td>
           <td>&nbsp;</td>
        </tr>
      <tr> <%-- 输出导入时的错误信息 --%>
           <td height="16" colspan="4" align="left" style="color:red;">
	           <s:if test="hasErrors()"> <%-- 判断 actionerror是否有错误信息 --%>
	           		错误信息如下：
	           		<s:actionerror />
	           </s:if>
           </td>
      </tr>
    </table>
 </s:form>
    
          </td>
      </tr>
      <tr>
          <td colspan="6" height="20"></td>
      </tr>
      
    </table>
    
    </td>
  </tr>
</table>

</div>

</div>

<DIV id="waitgif" style="DISPLAY: none">
	<img src="images/jdt.gif"/>
</DIV>

</body>
</html>
